package com.itheima10;

import java.util.*;

/**
 * @author Xiao
 * @date 2021/7/27
 */
public class MapDemo02 {
    /**
     * Map集合遍历
     */
    public static void main(String[] args) {
//        Collections.addAll(map, ("i1","asd"), ("aa", "i2"), ("bb","i3"));
        Map<String, String> map = new HashMap<>();
        map.put("i1", "aa");
        map.put("i2", "bb");
        map.put("i3", "cc");
        map.put("i4", "dd");
        for (String s : map.keySet()) {
            System.out.println(s + "\t" + map.get(s));
        }
        System.out.println("------------");
        Set<Map.Entry<String, String>> entries = map.entrySet();
        for (Map.Entry<String, String> entry : entries) {
            System.out.println(entry.getKey() + "\t" + entry.getValue());
        }
    }
}
